import request from '@/utils/request';
import type { TableListParams, TableListItem } from './data.d';
import {OrderStock, queryType} from "./data.d";
export async function queryOrderStockList(params:queryType) {
  return request('/hk/admin/order/stock/list', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json;charset=utf-8',
      'token':`${localStorage.getItem('token')}`
    },
    data:params
  });
}
export async function addOrderStock(params: OrderStock) {
  return request('/hk/admin/order/stock', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json;charset=utf-8',
      'token':`${localStorage.getItem('token')}`
    },
    data: params,
  });
}
// export async function queryRule(params?: TableListParams) {
//   return request('/btc/order/list', {
//     method: 'POST',
//     headers: {
//       'Content-Type': 'application/json;charset=utf-8',
//     },
//     // params,
//   });
// }
// export async function queryRule(params?: TableListParams) {
//   return request('/fss/Fund2PlanStock/DateList', {
//     method: 'GET',
//     headers: {
//       'Content-Type': 'application/json;charset=utf-8',
//     },
//   });
// }
//
export async function queryRule(params?: TableListParams) {
  return request('/api/rule', {
    params,
  });
}

export async function removeRule(params: { key: number[] }) {
  return request('/api/rule', {
    method: 'POST',
    data: {
      ...params,
      method: 'delete',
    },
  });
}

export async function addRule(params: TableListItem) {
  return request('/api/rule', {
    method: 'POST',
    data: {
      ...params,
      method: 'post',
    },
  });
}

export async function updateRule(params: TableListParams) {
  return request('/api/rule', {
    method: 'POST',
    data: {
      ...params,
      method: 'update',
    },
  });
}
